/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBean.TX.CustomerIOTRPortal;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
import session.CM.PortalManagementSB;

/**
 *
 * @author Randall Chia
 */
@ManagedBean (name = "returnURLMB")
@ViewScoped
public class returnURLMB {
    
    @EJB
    private PortalManagementSB portalManagementSBRemote;

    private String paymentCompleteURL;
    private String tCubePayPalEmail;

    /** Creates a new instance of returnURLMB */
    public returnURLMB() {
        
        
    }
    
    //Call this method in the value of a outputtext component. Remember to set escape = false
    public String test(){
    return "LINE 1 <br/> LINE 2";
    }
    
    
    public void setTransactionTypeintoSession(String transactionType){
        System.out.println("returnURLMB: TransactionType set into session: " + transactionType);
        FacesContext facesContext = FacesContext.getCurrentInstance();
        HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false);
        session.setAttribute("TransactionType", transactionType);
    }
    
   //==================================================================================================================
    
    public String getReturnURL_shoppingCartCheckout(){
        setTransactionTypeintoSession("shoppingCartCheckout");
        return getPaymentCompleteURL();
    }
    
    public String getReturnURL_buyGroupDeal(){
        setTransactionTypeintoSession("buyGroupDeal");
        return getPaymentCompleteURL();
    }
    
    public String getReturnURL_userBuyPoints(){
        setTransactionTypeintoSession("userBuyPoints");
        return getPaymentCompleteURL();
    }
    
    public String getReturnURL_stakeholderBuyPoints(){
        setTransactionTypeintoSession("stakeholderBuyPoints");
        return getPaymentCompleteURL();
    }
    
    public String getReturnURL_PerformanceTicketPurchase(){
        setTransactionTypeintoSession("buyPerformanceTickets");
        return getPaymentCompleteURL();
    }
    
    //==================================================================================================================

    /**
     * @return the paymentCompleteURL
     */
    public String getPaymentCompleteURL() {
        this.paymentCompleteURL = portalManagementSBRemote.getHostName() + "/paymentcomplete/statuspage.xhtml";
        return paymentCompleteURL;
    }

    /**
     * @param paymentCompleteURL the paymentCompleteURL to set
     */
    public void setPaymentCompleteURL(String paymentCompleteURL) {
        this.paymentCompleteURL = paymentCompleteURL;
    }

    /**
     * @return the tCubePayPalEmail
     */
    public String gettCubePayPalEmail() {
        this.tCubePayPalEmail = portalManagementSBRemote.getPayPalEmail();
        return tCubePayPalEmail;
    }

    /**
     * @param tCubePayPalEmail the tCubePayPalEmail to set
     */
    public void settCubePayPalEmail(String tCubePayPalEmail) {
        this.tCubePayPalEmail = tCubePayPalEmail;
    }
    

    
    
    
    
    
    
}
